package niu.toy.spring.support;


public class BeansException extends  RuntimeException{
    public BeansException(String msg) {
        super(msg);
    }

    public BeansException( String msg,  Throwable cause) {
        super(msg, cause);
    }

    /**
     * Return the detail message, including the message from the nested exception
     * if there is one.
     */
    @Override
    
    public String getMessage() {
        return buildMessage(super.getMessage(), getCause());
    }

    public static String buildMessage( String message,  Throwable cause) {
        if (cause == null) {
            return message;
        }
        StringBuilder sb = new StringBuilder(64);
        if (message != null) {
            sb.append(message).append("; ");
        }
        sb.append("nested exception is ").append(cause);
        return sb.toString();
    }
}
